import request from '@/utils/request'

export function getDetail(id) {
  return request({
    url: '/perf/resource/getDetail',
    method: 'get',
    params: { id }
  })
}

export function update(data) {
  return request({
    url: '/perf/resource/update',
    method: 'post',
    data
  })
}

export function deleteResourse(id) {
  return request({
    url: '/perf/resource/delete',
    method: 'get',
    params: { id }
  })
}

export function searchAll(pageNo, pageSize) {
  return request({
    url: '/perf/resource/find/all',
    method: 'get',
    params: { pageNo, pageSize }
  })
}

export function searchResource(resourceType) {
  return request({
    url: '/perf/resource/searchResource',
    method: 'get',
    params: { resourceType }
  })
}

export function myUpload(uploadId, data) {
  return request({
    url: '/perf/resource/upload?uploadId=' + uploadId,
    method: 'post',
    timeout: 3600000,
    data
  })
}

export function uploadProcess(uploadId) {
  return request({
    url: '/perf/resource/upload/process',
    method: 'get',
    params: { uploadId }
  })
}

export function clearProcess(uploadId) {
  return request({
    url: '/perf/resource/clear/process',
    method: 'get',
    params: { uploadId }
  })
}

export function getAllNames() {
  return request({
    url: '/perf/resource/getAllNames',
    method: 'get'
  })
}
